<?php
	include "../../Controller/Admin/ctrl_sanpham_capnhat.php";
?>
<div id="center_tieude">
    <img src="../../Picture/admin.ico"/>
    <h3>Cập Nhật Thông Tin Sản Phẩm</h3>        
</div> <!--end id center_tieude-->

<div class="themmoi">
	<form action="" method="post" enctype="multipart/form-data">
        <table>
        <?php 
			$arr=sanpham::GetSP_byId($_GET['id']);
			for($i=0;$i<count($arr);$i++)
			{?>
            <tr>
                <td align="right" >Mã sản phẩm<span style="color:red">(*)</span></td>
                <td align="left"><input type="text" name="masp" disabled="disabled" value="<?php echo $_GET['id'] ?>"></td>
            </tr>
            <tr>
                <td align="right" >Tên sản phẩm<span style="color:red">(*)</span></td>
                <td align="left"><input type="text" name="tensp" value="<?php echo $arr[$i]->Ten; ?>"></td>
            </tr>
            <tr>
                <td align="right" >Đơn giá<span style="color:red">(*)</span></td>
                <td align="left"><input type="text" name="dongia" value="<?php echo $arr[$i]->Gia; ?>"></td>
            </tr>
            <tr>
                <td align="right" >Nhà sản xuất<span style="color:red">(*)</span></td>
                <td align="left">
                	<select name="nsx">
                    	<?php
                        	if($arr[$i]->NhaSX=='acer')
								echo '<option value="acer" selected="selected">Acer</option>
									<option value="apple">Apple</option>
									<option value="asus">Asus</option>
									<option value="hp-compaq">HP-Compaq</option>
									<option value="lenovo">Lenovo</option>
									<option value="sony">Sony</option>
									<option value="toshiba">Toshiba</option>';
							else
								if($arr[$i]->NhaSX=='apple')
								echo '<option value="acer">Acer</option>
									<option value="apple" selected="selected">Apple</option>
									<option value="asus">Asus</option>
									<option value="hp-compaq">HP-Compaq</option>
									<option value="lenovo">Lenovo</option>
									<option value="sony">Sony</option>
									<option value="toshiba">Toshiba</option>';
								else
									if($arr[$i]->NhaSX=='asus')
										echo '<option value="acer">Acer</option>
											<option value="apple">Apple</option>
											<option value="asus" selected="selected">Asus</option>
											<option value="hp-compaq">HP-Compaq</option>
											<option value="lenovo">Lenovo</option>
											<option value="sony">Sony</option>
											<option value="toshiba">Toshiba</option>';
									else
										if($arr[$i]->NhaSX=='hp-compaq')
											echo '<option value="acer">Acer</option>
												<option value="apple">Apple</option>
												<option value="asus">Asus</option>
												<option value="hp-compaq" selected="selected">HP-Compaq</option>
												<option value="lenovo">Lenovo</option>
												<option value="sony">Sony</option>
												<option value="toshiba">Toshiba</option>';
										else
											if($arr[$i]->NhaSX=='lenovo')
												echo '<option value="acer">Acer</option>
													<option value="apple">Apple</option>
													<option value="asus">Asus</option>
													<option value="hp-compaq" >HP-Compaq</option>
													<option value="lenovo" selected="selected">Lenovo</option>
													<option value="sony">Sony</option>
													<option value="toshiba">Toshiba</option>';
											else
												if($arr[$i]->NhaSX=='sony')
													echo '<option value="acer">Acer</option>
														<option value="apple">Apple</option>
														<option value="asus">Asus</option>
														<option value="hp-compaq" >HP-Compaq</option>
														<option value="lenovo">Lenovo</option>
														<option value="sony" selected="selected">Sony</option>
														<option value="toshiba">Toshiba</option>';
												else
													echo '<option value="acer">Acer</option>
														<option value="apple">Apple</option>
														<option value="asus">Asus</option>
														<option value="hp-compaq" >HP-Compaq</option>
														<option value="lenovo">Lenovo</option>
														<option value="sony">Sony</option>
														<option value="toshiba" selected="selected">Toshiba</option>';
						?>
                    	                     
                    </select>
                </td>
            </tr>
            <tr>
                <td align="right" >Trạng thái <span style="color:red">(*)</span></td>
                <td align="left">
                    <select name="trangthai">
                    	<?php
                        	if($arr[$i]->TrangThai==1)
								echo '<option value="1" selected="selected">Còn Hàng</option>
                       				 <option value="0">Hết Hàng</option>';
							else
								echo '<option value="1">Còn Hàng</option>
                       				 <option value="0" selected="selected">Hết Hàng</option>';
						?>
                        
                    </select>
                </td>
            </tr>
            <tr>
                <td align="right" >Mô tả <span style="color:red">(*)</span></td>
                <td align="left"><textarea rows="6" cols="16" name="mota"><?php echo $arr[$i]->MoTa ?></textarea></td>
            </tr>
            <tr>
                <td align="right" >Hình ảnh <span style="color:red"></span></td>
                <td align="left">
                	<input type="text" name="hinhanh" value="<?php echo $arr[$i]->Hinh; ?>"/>
                    <input type="file" name="fileedit" value="...">
                </td>
            </tr>
            <tr>
                <td align="right" >Đề nghị <span style="color:red">(*)</span></td>
                <td align="left">
                    <select name="denghi">
                    	<?php
                        	if($arr[$i]->DeNghi==1)
								echo '<option value="1" selected="selected">Đề nghị</option>
                        			  <option value="0">Không đề nghị</option>';
							else
								echo '<option value="1">Đề nghị</option>
			                          <option value="0" selected="selected">Không đề nghị</option>';
						?>
                    </select>
                </td>
            </tr>
        <?php }?>
            <tr>
                <td></td>
                <td >
                    <input  type="submit" name="capnhatsanpham" value="Cập Nhật">
                    <input  type="submit" name="nhaplaisanpham" value="Nhập Lại">
                    <a href="./admin.php?obj=sanpham"><input  type="button" name="huy" value="Hủy"></a>
                </td>
            </tr>
        </table>
     </form>
</div>